package com.xucy.springboot.controller;

import com.xucy.springboot.entity.Person;
import com.xucy.springboot.entity.ResultMsg;
import com.xucy.springboot.service.PersonService;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedList;
import java.util.List;

@RestController
@RequestMapping("/person")
public class PersonController {
    @Autowired
    private PersonService personService;

    @RequestMapping("/findAll")
    public List<Person> findAllPerson() {
        try{
            System.out.println("进来了");
            System.out.println("又进来咯");

            int i=1/0;
        }catch (Exception e){
            throw new RuntimeException("出bug了");
        }

        return personService.findAllPerson();
    }

    @RequestMapping("/testVo")
    public List testVo() {
        List<ResultMsg> people = new LinkedList<>();

        System.out.println("又进来咯");
        ResultMsg resultMsg = new ResultMsg(1, "测试");
        people.add(resultMsg);
        return people;
    }

    public static void main(String[] args) {
        int i=17;
        String a="下2上";
        System.out.println(Integer.toBinaryString(i));
        System.out.println(Integer.toOctalString(i));
        System.out.println(Integer.toHexString(i));
        System.out.println(a.getBytes().length);
    }
}
